<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8"/>
  <title>新闻列表</title>
  <link rel="stylesheet" href="/css/bootstrap.css" th:href="@{/css/bootstrap.css}"/>
</head>
<body class="container">
<br/>
<h1>新闻列表</h1>
<br/><br/>
<div class="with:80%">
  <table class="table table-hover">
    <thead>
    <tr>
      <th>序号</th>
      <th>新闻标题</th>
      <th>新闻作者</th>
      <th>新闻内容</th>
      <th>创建时间</th>
      <th>更新时间</th>
      <th>编辑</th>
      <th>删除</th>
    </tr>
    </thead>
    <tbody>
    <tr  th:each="article : ${articles}">
      <th scope="row" th:text="${article.id}"></th>
      <td th:text="${article.title}"></td>
      <td th:text="${article.author}"></td>
      <td th:text="${article.content}"></td>
      <td th:text="${#dates.format(article.ctime, 'yyyy-MM-dd HH:mm:ss')}"></td>
      <td th:text="${#dates.format(article.utime, 'yyyy-MM-dd HH:mm:ss')}"></td>
      <td><a th:href="@{/toEditArticle(id=${article.id},title=${article.title})}">编辑</a></td>
      <td><a th:href="@{/deleteArticle(id=${article.id})}">删除</a></td>
    </tr>
    </tbody>
  </table>
</div>
<div class="form-group">
  <div class="col-sm-2 control-label" >
    <a href="userLogin.html" th:href="@{/toAddArticle}" class="btn btn-info">添加</a>
  </div>
</div>
</body>
</html>